package homework4;

public class D4 {

	public static void main(String[] args) {
		int oldArr[]={1,3,4,5,0,0,6,6,0,5,4,7,6,7,0,5} ;
		byte count = 0;
		for (int i = 0; i < oldArr.length; i++) {
			if(oldArr[i] != 0){
				count ++;
			}
		} 
		int[] newArr = new int[count];
		count = 0;
		for (int i = 0; i < oldArr.length; i++) {
				if(oldArr[i] != 0){
					newArr[count ++] = oldArr[i];
				}
			}
		 System.out.print("int newArr[]={");
		for (int i = 0; i < newArr.length - 1; i++) {
			System.out.print(newArr[i] + ",");
		}
		System.out.print(newArr[newArr.length - 1] + "}");


	}

}
